package uscdb.dao.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Repository;

import uscdb.dao.ProductDaoI;
import uscdb.model.Tproduct;

@Repository
public class ProductDaoImpl extends BaseDaoImpl<Tproduct> implements ProductDaoI {

	@Override
	public Tproduct getByName(String productName) {
		String hql = "from Tproduct t where t.name = :name";
		Map<String, Object> params = new HashMap<>();
		params.put("name", productName);
		Tproduct tproduct = get(hql, params);
		if (null != tproduct) {
			return tproduct;
		}
		return null;

	}

}
